package com.skydonkey.dao;

import com.github.pagehelper.Page;
import com.skydonkey.pojo.po.AccountInfo;
import com.skydonkey.pojo.po.AccountInfoDetails;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AccountInfoMapper {

    @Select("SELECT * FROM account_info WHERE uid = #{uid}")
    AccountInfo findById(@Param("uid") Long uid);

    @Select("SELECT * FROM account_info")
    List<AccountInfo> findAll();

    @Insert("INSERT INTO account_info (uid, birthday, brief_introduction, signature, sex, province, county) " +
            "VALUES (#{uid}, #{birthday}, #{briefIntroduction}, #{signature}, #{sex}, #{province}, #{county})")
    int insert(AccountInfo accountInfo);

    @Update("UPDATE account_info SET birthday = #{birthday}, brief_introduction = #{briefIntroduction}, " +
            "signature = #{signature}, sex = #{sex}, province = #{province}, county = #{county} ," +
            "head_pic_url = #{headPicUrl} WHERE uid = #{uid}")
    int update(AccountInfo accountInfo);

    @Delete("DELETE FROM account_info WHERE uid = #{uid}")
    int deleteById(@Param("uid") Long uid);


}
